<?php 
/* this is an ebay redirect script that takes 
 * a query, queries ebay and redirects the user
 * to the proper result page. */
require_once("config.php");
require_once("class/ebay.class.php");
require_once("class/database.class.php");
require_once("class/blog.class.php");

// requires ebay site config values loaded
$b = new blog($_SERVER["HTTP_HOST"]);

// define the search query
$q = "netzwerk";
if(array_key_exists("q", $_GET)){
	$q = str_replace("-", " ", $_GET["q"]);
}

// construct the ebay class
$e = new ebay();
$result = $e->findProducts($q);

// redirect to the ebay results
header ("HTTP/1.0 302 Moved Temporarily");
header("Location: ".$result->itemSearchURL);
?>